import React from 'react';
import ItemSelectionModal from './ItemSelectionModal';
import type { SelectionItem } from './ItemSelectionModal';

export interface UserSelectModalProps {
  title?: string;
  visible: boolean;
  selectedIds?: string[];
  users: SelectionItem[];
  searchPlaceholder?: string;
  confirmText?: string;
  cancelText?: string;
  onCancel: () => void;
  onConfirm: (selectedItems: SelectionItem[]) => void;
  onLoadChildren?: (nodeId: string) => Promise<SelectionItem[]>;
}

const UserSelectModal: React.FC<UserSelectModalProps> = ({
  title = "选择用户",
  visible,
  selectedIds = [],
  users,
  searchPlaceholder = "搜索用户名，部门，或用户",
  confirmText = "确定",
  cancelText = "取消",
  onCancel,
  onConfirm,
  onLoadChildren
}) => {
  return (
    <ItemSelectionModal
      title={title}
      visible={visible}
      dataSource={users}
      selectedIds={selectedIds}
      treeMode={true}
      searchPlaceholder={searchPlaceholder}
      confirmText={confirmText}
      cancelText={cancelText}
      onCancel={onCancel}
      onConfirm={onConfirm}
      onLoadChildren={onLoadChildren}
    />
  );
};

export default UserSelectModal; 